<?php
/*! \brief
 * This is extension class WFDataObject for Sqlite
 * \author William Su
 */
require_once dirname(__FILE__).'/DatabaseObject.interface.php';
require_once dirname(__FILE__).'/DatabaseObject.php';
class WFDatabaseObjectSqlite extends  WFDatabaseObject implements IDatabaseObject
{
    /**
     *\brief Description
     * Check is specific table existed?
     * If existed return true, if not existed return false.
     * @param string $strTableName table name
     * @return bool
     */
    public function isTableExists($strTableName){
        $sql = "SELECT name FROM sqlite_master WHERE type=:table AND name=:strTableName";
        $sqlvalues = array(':table'=>'table',':strTableName'=>$strTableName);
        ////$strTableNameInDB = $this->query($sql,$sqlvalues);
        ////$strTableNameInDB = isset($strTableNameInDB['0']['name']) ? $strTableNameInDB['0']['name'] : '0';
        //var_dump($strTableNameInDB);
        ///$ret = $strTableNameInDB == $strTableName ? true : false;
        ////return false;
        $strTableNameInDB = $this->fetchOne($sql,$sqlvalues);
        $ret = $strTableNameInDB == $strTableName ? true : false;
        return $ret;
    }
}